<template>
    <div>
        <el-button type="primary" @click="add">添加</el-button>
        <el-form ref="form" label-width="80px">
            <el-form-item label="活动名称" v-for="(item, index) in formData" :key="item.id">
                <el-input v-model="item.name"></el-input>
            </el-form-item>
        </el-form>
        <com-a></com-a>
    </div>
</template>

<script>
    import ComA from './ComA';
    export default {
        name: 'RbacProjectUiForm',
        components:{
            ComA
        },
        data() {
            return {
                formData: [
                    {
                        id: 1,
                        name: '张三'
                    },
                    {
                        id: 2,
                        name: '李四'
                    },
                    {
                        id: 3,
                        name: '王五'
                    }
                ]
            };
        },

        mounted() {

        },

        methods: {
            add() {
                this.formData.push({
                    id: this.formData.length + 1,
                    name: ''
                })
                console.log(this.formData);
            }
        },
    };
</script>